1
2
3
4
5 package com.jguild.jrpm.io.constant;
6
7
8 /***
9 * Constants for index type.
10 *
11 * @version $Id: RPMIndexType.java,v 1.3 2003/10/20 16:32:12 mkuss Exp $
12 */
13 public final class RPMIndexType implements EnumIf {
14 public static final RPMIndexType UNKNOWN = new RPMIndexType(_UNKNOWN, "UNKNOWN", 0);
15 public static final int _NULL = 0;
16 public static final RPMIndexType NULL = new RPMIndexType(_NULL, "NULL", 0);
17 public static final int _CHAR = 1;
18 public static final RPMIndexType CHAR = new RPMIndexType(_CHAR, "CHAR", 1);
19 public static final int _INT8 = 2;
20 public static final RPMIndexType INT8 = new RPMIndexType(_INT8, "INT8", 1);
21 public static final int _INT16 = 3;
22 public static final RPMIndexType INT16 = new RPMIndexType(_INT16, "INT16", 2);
23 public static final int _INT32 = 4;
24 public static final RPMIndexType INT32 = new RPMIndexType(_INT32, "INT32", 4);
25 public static final int _INT64 = 5;
26 public static final RPMIndexType INT64 = new RPMIndexType(_INT64, "INT64", 8);
27 public static final int _STRING = 6;
28 public static final RPMIndexType STRING = new RPMIndexType(_STRING, "STRING", 1);
29 public static final int _BIN = 7;
30 public static final RPMIndexType BIN = new RPMIndexType(_BIN, "BIN", 1);
31 public static final int _STRING_ARRAY = 8;
32 public static final RPMIndexType STRING_ARRAY = new RPMIndexType(_STRING_ARRAY, "STRING_ARRAY", 1);
33 public static final int _I18NSTRING = 9;
34 public static final RPMIndexType I18NSTRING = new RPMIndexType(_I18NSTRING, "I18NSTRING", 1);
35 private EnumIf delegate;
36 private int size;
37
38 private RPMIndexType(int type, String name, int size) {
39 delegate = new EnumDelegate(RPMIndexType.class, type, name, this);
40 this.size = size;
41 }
42
43 /***
44 * Get a enum by id
45 *
46 * @param id The id of the enum
47 * @return The enum object
48 */
49 public static EnumIf getEnumById(long id) {
50 return EnumDelegate.getEnumById(RPMIndexType.class, id);
51 }
52
53 /***
54 * Get a enum by name
55 *
56 * @param name The name of the enum
57 * @return The enum object
58 */
59 public static EnumIf getEnumByName(String name) {
60 return EnumDelegate.getEnumByName(RPMIndexType.class, name);
61 }
62
63 /***
64 * Get all defined enums of this class
65 *
66 * @return An array of all defined enum objects
67 */
68 public static String[] getEnumNames() {
69 return EnumDelegate.getEnumNames(RPMIndexType.class);
70 }
71
72 /***
73 * Get a enum of this class by id
74 *
75 * @param type The id
76 * @return The enum object
77 */
78 public static RPMIndexType getRPMIndexType(long type) {
79 return (RPMIndexType) getEnumById(type);
80 }
81
82 /***
83 * Get the size of this enum in byte
84 *
85 * @return The size in byte
86 */
87 public int getSize() {
88 return size;
89 }
90
91 /***
92 * Check if this enum class contains a enum of a specified id
93 *
94 * @param id The id of the enum
95 * @return TRUE if the enum is defined in this class
96 */
97 public static boolean containsEnumId(Long id) {
98 return EnumDelegate.containsEnumId(RPMIndexType.class, id);
99 }
100
101
102
103
104 public long getId() {
105 return delegate.getId();
106 }
107
108
109
110
111 public String getName() {
112 return delegate.getName();
113 }
114
115
116
117
118 public String toString() {
119 return delegate.toString();
120 }
121 }